package com.app.micaihu.view.army.presenter

import com.app.base.mvp.BasePresenter
import com.app.http.NetRequestListener
import com.app.http.bean.BaseBean
import com.app.micaihu.utils.ApiServiceUtils.apiService
import com.app.micaihu.utils.ParamsMapUtils
import com.app.micaihu.view.army.contract.ArmyHonourContract
import com.app.micaihu.view.bean.ArmyHonour

/**
 * 军团勋章
 */
open class ArmyHonourPresenter : BasePresenter<ArmyHonourContract.View>(), ArmyHonourContract.Presenter {

    override fun honour(uid: String) {
        val params = ParamsMapUtils.commonParams
        params["uid"] = uid
        requestNetwork(apiService.armyHonour(params), object : NetRequestListener<BaseBean<ArmyHonour?>?> {
            override fun onSuccess(result: BaseBean<ArmyHonour?>?) {
                getView()?.hideLoading()
                getView()?.handleHonour(result)
            }

            override fun onFailed(e: Throwable?) {
                getView()?.hideLoading()
                getView()?.handleHonour(null)
                getView()?.onError(e)
            }
        })
    }

}